package org.jeecg.modules.wechat;

import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;

/**
 * 微信校验
 * Created by ：zou
 * Date：2019/8/22 15:45
 */

@RequestMapping("/wechat")
@Controller
@Slf4j
public class WeChatController {


    /**
     * 验证微信端
     * @param echostr 随机字符串
     * @param signature 结合了开发者填写的token参数和请求中的timestamp参数、nonce参数
     * @param timestamp 时间戳
     * @param nonce 随机数
     * @return
     */
    @GetMapping
    public String checkWeChat( @RequestParam(required = false) String echostr,
                               @RequestParam(required = false) String signature,
                               @RequestParam(required = false) String timestamp,
                               @RequestParam(required =false) String nonce){
        //只需要把微信请求的 echostr, 返回给微信就可以了
        log.info("测试来过===================" + echostr);
        log.info("测试来过===================" + signature);
        log.info("测试来过===================" + timestamp);
        log.info("测试来过===================" + nonce);
        return echostr;
    }












}
